package com.ssn.reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class PrivateTest2
{
	public static void main(String[] args) throws Exception
	{
		Private2 p2=new Private2();
		Class<?> classType=p2.getClass();
		
		Field field=classType.getDeclaredField("name");
		
//		Field field=classType.getField("name");
		field.setAccessible(true);
		field.set(p2, "lisi");
		Method method=classType.getDeclaredMethod("getName");
		method.setAccessible(true);
		Object result=method.invoke(p2);
		System.out.println((String)result);
	}
}
